home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Library / +ORC / Orc pac 2 / FILEZ.ZIP / PERISCOP.ZIP / FTOC.C < prev    next >
Encoding:
Text File  |  1993-06-18  |  505 b   |  21 lines

  1.   /* print Fahrenheit-Celsius table
  2.     for f = 0, 20, ..., 300
  3.     (This program is from p. 8 of the Kernighan and Ritchie text)
  4.     */
  5.  
  6. main()
  7. {
  8.     int lower, upper, step;
  9.     float fahr, celsius;
  10.     lower = 0;           /* lower limit of temperature table */
  11.     upper = 300;       /* upper limit */
  12.     step = 20;           /* step size */
  13.  
  14.     fahr = lower;
  15.     while (fahr <= upper) {
  16.     celsius = (5.0/9.0) * (fahr-32.0);
  17.     printf("%4.0f %6.1f\n", fahr, celsius);
  18.     fahr = fahr + step;
  19.     }
  20. }
  21.